class Store {

  set(key, value) {
    if (typeof value == 'object') {
      value = JSON.stringify(value)
    }
    localStorage.setItem(key, value)
  }

  get(key) {
    let value = localStorage.getItem(key) || ''
    // eslint-disable-next-line
    if (/^[\[\{]/.test(value)) {
      value = JSON.parse(value)
    }
    return value
  }

  del(key) {
    localStorage.removeItem(key)
  }

}

// eslint-disable-next-line
export default new Store;